﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Globalization;
using System.Runtime.Serialization;
namespace GSLMS.Entity
{
	/// <summary>
	/// 2.2.2    拆借同行设置信息表
	/// </summary>
	[DataContract(IsReference = true)]
	public partial class TB_FIN_EXCLOANSET: IObjectWithChangeTracker, INotifyPropertyChanged
	{
		public TB_FIN_EXCLOANSET()
		{}
		#region Model
		private long _id;
		private string _custname;
		private string _custno;
		private string _mobile1;
		private string _mobile2;
		private string _linkman;
		private string _linkmanmobile;
		private string _linkmantelcode;
		private string _linkmantel;
		private string _linkmantelsub;
		private int _payment;
		private int _iseffect;
		private string _createby;
		private Nullable<DateTime> _createdate;
		private string _remark;
		private int _sparefield1;
		private string _sparefield2;
		private string _sparefield3;
		/// <summary>
		/// 记录ID
		/// </summary>
		[DataMember]
		public long ID
		{
			get{return _id;}
			set{
				if ( _id!= value)
				{
					if (ChangeTracker.ChangeTrackingEnabled && ChangeTracker.State != ObjectState.Added)
					{
						throw new InvalidOperationException("属性“ID”是对象键的一部分，不可更改。仅当未跟踪对象或对象处于“已添加”状态时，才能对键属性进行更改。");
					}
					 _id = value;
					OnPropertyChanged("ID");
				}
			}
		}
		/// <summary>
		/// 名称
		/// </summary>
		[DataMember]
		public string CUSTNAME
		{
			get{return _custname;}
			set{
				if ( _custname!= value)
				{
					 _custname = value;
					OnPropertyChanged("CUSTNAME");
				}
			}
		}
		/// <summary>
		/// 证件号码
		/// </summary>
		[DataMember]
		public string CUSTNO
		{
			get{return _custno;}
			set{
				if ( _custno!= value)
				{
					 _custno = value;
					OnPropertyChanged("CUSTNO");
				}
			}
		}
		/// <summary>
		/// 手机号1
		/// </summary>
		[DataMember]
		public string MOBILE1
		{
			get{return _mobile1;}
			set{
				if ( _mobile1!= value)
				{
					 _mobile1 = value;
					OnPropertyChanged("MOBILE1");
				}
			}
		}
		/// <summary>
		/// 手机号2
		/// </summary>
		[DataMember]
		public string MOBILE2
		{
			get{return _mobile2;}
			set{
				if ( _mobile2!= value)
				{
					 _mobile2 = value;
					OnPropertyChanged("MOBILE2");
				}
			}
		}
		/// <summary>
		/// 财务联系人
		/// </summary>
		[DataMember]
		public string LINKMAN
		{
			get{return _linkman;}
			set{
				if ( _linkman!= value)
				{
					 _linkman = value;
					OnPropertyChanged("LINKMAN");
				}
			}
		}
		/// <summary>
		/// 财务联系人手机
		/// </summary>
		[DataMember]
		public string LINKMANMOBILE
		{
			get{return _linkmanmobile;}
			set{
				if ( _linkmanmobile!= value)
				{
					 _linkmanmobile = value;
					OnPropertyChanged("LINKMANMOBILE");
				}
			}
		}
		/// <summary>
		/// 财务联系人座机区号
		/// </summary>
		[DataMember]
		public string LINKMANTELCODE
		{
			get{return _linkmantelcode;}
			set{
				if ( _linkmantelcode!= value)
				{
					 _linkmantelcode = value;
					OnPropertyChanged("LINKMANTELCODE");
				}
			}
		}
		/// <summary>
		/// 财务联系人座机
		/// </summary>
		[DataMember]
		public string LINKMANTEL
		{
			get{return _linkmantel;}
			set{
				if ( _linkmantel!= value)
				{
					 _linkmantel = value;
					OnPropertyChanged("LINKMANTEL");
				}
			}
		}
		/// <summary>
		/// 财务联系人座机分机号
		/// </summary>
		[DataMember]
		public string LINKMANTELSUB
		{
			get{return _linkmantelsub;}
			set{
				if ( _linkmantelsub!= value)
				{
					 _linkmantelsub = value;
					OnPropertyChanged("LINKMANTELSUB");
				}
			}
		}
		/// <summary>
		/// 利息计算参数1算头不算尾，2算头算尾,默认为1
		/// </summary>
		[DataMember]
		public int PAYMENT
		{
			get{return _payment;}
			set{
				if ( _payment!= value)
				{
					 _payment = value;
					OnPropertyChanged("PAYMENT");
				}
			}
		}
		/// <summary>
		/// 是否失效0否,1是
		/// </summary>
		[DataMember]
		public int ISEFFECT
		{
			get{return _iseffect;}
			set{
				if ( _iseffect!= value)
				{
					 _iseffect = value;
					OnPropertyChanged("ISEFFECT");
				}
			}
		}
		/// <summary>
		/// 录入人
		/// </summary>
		[DataMember]
		public string CREATEBY
		{
			get{return _createby;}
			set{
				if ( _createby!= value)
				{
					 _createby = value;
					OnPropertyChanged("CREATEBY");
				}
			}
		}
		/// <summary>
		/// 录入时间
		/// </summary>
		[DataMember]
		public Nullable<DateTime> CREATEDATE
		{
			get{return _createdate;}
			set{
				if ( _createdate!= value)
				{
					 _createdate = value;
					OnPropertyChanged("CREATEDATE");
				}
			}
		}
		/// <summary>
		/// 备注
		/// </summary>
		[DataMember]
		public string REMARK
		{
			get{return _remark;}
			set{
				if ( _remark!= value)
				{
					 _remark = value;
					OnPropertyChanged("REMARK");
				}
			}
		}
		/// <summary>
		/// 预留字段1
		/// </summary>
		[DataMember]
		public int SPAREFIELD1
		{
			get{return _sparefield1;}
			set{
				if ( _sparefield1!= value)
				{
					 _sparefield1 = value;
					OnPropertyChanged("SPAREFIELD1");
				}
			}
		}
		/// <summary>
		/// 预留字段2
		/// </summary>
		[DataMember]
		public string SPAREFIELD2
		{
			get{return _sparefield2;}
			set{
				if ( _sparefield2!= value)
				{
					 _sparefield2 = value;
					OnPropertyChanged("SPAREFIELD2");
				}
			}
		}
		/// <summary>
		/// 预留字段3
		/// </summary>
		[DataMember]
		public string SPAREFIELD3
		{
			get{return _sparefield3;}
			set{
				if ( _sparefield3!= value)
				{
					 _sparefield3 = value;
					OnPropertyChanged("SPAREFIELD3");
				}
			}
		}
		#endregion Model

	#region ChangeTracking
	   
	protected virtual void OnPropertyChanged(String propertyName)
	{
	    if (ChangeTracker.State != ObjectState.Added && ChangeTracker.State != ObjectState.Deleted)
	    {
	        ChangeTracker.State = ObjectState.Modified;
	    }
	    if (_propertyChanged != null)
	    {
	        _propertyChanged(this, new PropertyChangedEventArgs(propertyName));
	    }
	}
	   
	protected virtual void OnNavigationPropertyChanged(String propertyName)
	{
	    if (_propertyChanged != null)
	    {
	        _propertyChanged(this, new PropertyChangedEventArgs(propertyName));
	    }
	}
	   
	event PropertyChangedEventHandler INotifyPropertyChanged.PropertyChanged{ add { _propertyChanged += value; } remove { _propertyChanged -= value; } }
	private event PropertyChangedEventHandler _propertyChanged;
	private ObjectChangeTracker _changeTracker;
	   
	[DataMember]
	public ObjectChangeTracker ChangeTracker
	{
	    get
	    {
	        if (_changeTracker == null)
	        {
	            _changeTracker = new ObjectChangeTracker();
	            _changeTracker.ObjectStateChanging += HandleObjectStateChanging;
	        }
	        return _changeTracker;
	    }
	    set
	    {
	        if(_changeTracker != null)
	        {
	            _changeTracker.ObjectStateChanging -= HandleObjectStateChanging;
	        }
	        _changeTracker = value;
	        if(_changeTracker != null)
	        {
	            _changeTracker.ObjectStateChanging += HandleObjectStateChanging;
	        }
	    }
	}
	   
	private void HandleObjectStateChanging(object sender, ObjectStateChangingEventArgs e)
	{
	    if (e.NewState == ObjectState.Deleted)
	    {
	        ClearNavigationProperties();
	    }
	}
	   
	protected bool IsDeserializing { get; private set; }
	   
	[OnDeserializing]
	public void OnDeserializingMethod(StreamingContext context)
	{
	    IsDeserializing = true;
	}
	   
	[OnDeserialized]
	public void OnDeserializedMethod(StreamingContext context)
	{
	    IsDeserializing = false;
	    ChangeTracker.ChangeTrackingEnabled = true;
	}
	   
	protected virtual void ClearNavigationProperties()
	{
	}
	
	#endregion

	}
}

